function model=update_eta(model, MaxFun)


% global model;
% global j;

k       = model.k;
k_hat   = model.k_hat;
options = optimset('Algorithm','interior-point','GradObj','on', 'MaxFunEvals', MaxFun, 'Display', 'off');

for j=1:k_hat 
    
 x0  = model.eta(j,:)';
 A   = -eye(k);
 B   = zeros(k, 1)-0.00000001;
%  Aeq = ones(1,k);
%  Beq = 1;
  
 Aeq = [];
 Beq = [];
 
 temp      = [];
 temp      = fmincon(@L_etaj, x0, A, B, Aeq, Beq, [], [], [], options, model, j); 
 ind       = find(temp<model.MINVALUE);
 temp(ind) = model.MINVALUE;
 
 model.eta(j,:) = temp';
 
end

end
